package com.zareal.feign;

import com.zareal.dot.PutApplicationDto;
import com.zareal.enums.GlobalErrorCode;
import com.zareal.result.JSONResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class PurchaseFallbackFactory implements FallbackFactory<PurChaseFeignClient> {


    @Override
    public PurChaseFeignClient create(Throwable throwable) {
        return new PurChaseFeignClient() {
            @Override
            public JSONResult purcharseProduct(PutApplicationDto putApplicationDto) {
                return JSONResult.success(GlobalErrorCode.STORE_PUT_ERROR);
            }

            @Override
            public JSONResult passApplication(Long id) {
                return JSONResult.success(GlobalErrorCode.STORE_PUT_ERROR);
            }

            @Override
            public JSONResult failApplication(Long id) {
                return JSONResult.success(GlobalErrorCode.STORE_PUT_ERROR);
            }
        };
    }
}
